package com.haiya.command.basic;

public class Client {
    public static void main(String[] args) {
        System.out.println("Init as CommandA ---------------------------");
        // 使用command A初始化调用者并执行call()
        ConcreteCommandA commandA = new ConcreteCommandA();
        Invoker invoker = new Invoker(commandA);
        invoker.call();

        System.out.println("Switch to CommandB ---------------------------");
        // 切换命令再执行call()
        ConcreteCommandB commandB = new ConcreteCommandB();
        invoker.setCommand(commandB);
        invoker.call();
    }
}